//
//  BLMy_Cell_Index.m
//  Byelone
//
//  Created by 乔小乔 on 2020/12/15.
//

#import "BLMy_Cell_Index.h"
#import "BLInfoModel.h"
@implementation BLMy_Cell_Index

- (void)awakeFromNib {
    [super awakeFromNib];
    self.imgHeadPic.layer.cornerRadius = 30;
    self.imgHeadPic.layer.masksToBounds = YES;
    self.viewInfo.layer.cornerRadius = 6;
    [self.viewInfo setShadowRadius:6 color:BL_COLOR_PURPLE_L(0.12) offset:CGSizeMake(0, 0) opacity:1];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)reloadWithData:(BLInfoUserInfo *)model baseModel:(BLInfoBaseInfo *)baseInfo{
    if (model) {
        [self.imgHeadPic sd_setImageWithURL:[NSURL URLWithString:model.picture?:@""]];
        self.labelName.text = model.nickName;
        if (baseInfo.gender == 1) {//男
            self.labelZhenZhu.text = model.receivingGiftNum;
            self.labelBeiKe.text = model.giftNum;
        }else{//2女
            self.labelZhenZhu.text = model.giftNum;
            self.labelBeiKe.text = model.receivingGiftNum;
        }
        self.imgVip.hidden = !model.vip;
        
        [self.viewTags.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

        CGFloat left = 0;
        if (model.identityAuth) {
            UIImageView *idImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"my_rz_identity"]];
            [self.viewTags addSubview:idImg];
            [idImg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.left.bottom.mas_equalTo(0);
                make.width.mas_equalTo(48.5);
            }];
            left = 48.5+4.5;
        }
        if (model.gradeAuth) {
            UIImageView *idImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"my_rz_school"]];
            [self.viewTags addSubview:idImg];
            [idImg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.bottom.mas_equalTo(0);
                make.width.mas_equalTo(48.5);
                make.left.mas_equalTo(left);
            }];
            left = 48.5+4.5;
        }
    }
}

@end
